package cn.tannn.surenessdemo.sureness.provider;

import cn.tannn.surenessdemo.redis.service.RedisService;
import com.usthe.sureness.matcher.PathTreeProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Set;

/**
 * todo 刷新和初始化都还到这，对 TirePathTree.PATTERN_MAP 进行刷新
 * 角色权限
 * @author tomsun28
 * @date 16:00 2019-08-04
 */
@Component
public class DatabasePathTreeProvider implements PathTreeProvider {

    @Autowired
    private RedisService redisService;

    @Override
    public Set<String> providePathData() {
        // redis查询 需要拦截的资源 ( 刷新时请先存一遍redis
        return redisService.providePathData(getContextPath());
    }

    @Override
    public Set<String> provideExcludedResource() {
        // redis查询 不被拦截的资源（即放行资源
        return redisService.provideExcludedResource(getContextPath());
    }

}
